package com.dhcc.DRGsHosp.web.controller;

import org.dayatang.utils.Page;
import org.openkoala.koala.commons.InvokeResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.dhcc.DRGsHosp.facade.CliSpecFacade;
import com.dhcc.DRGsHosp.facade.dto.CliSpecDTO;


/**
 * @title		: CliSpecController.java 
 * @description	: 
 * @author		: chl
 * @date		: 2016年12月7日
 * @version     : 2016
 * @copyright   : DHCC 
 */

@Controller("drgsHospWebController3")
@RequestMapping(value = "/cliSpec")
public class CliSpecController {
	@Autowired
	private CliSpecFacade cliSpecFacade ;
	
	@ResponseBody
	@RequestMapping(value = "/findAllCliSpecs")
	public InvokeResult findAllCliSpecs(){
		return InvokeResult.success(cliSpecFacade.findAllCliSpecs()) ;
	}
	
	@ResponseBody
	@RequestMapping(value = "/pageJson")
	public Page<CliSpecDTO> pageJson(CliSpecDTO cliSpecDTO, @RequestParam int page, @RequestParam int pagesize) {
		return cliSpecFacade.pageJson(cliSpecDTO,page,pagesize) ;
	}
	
	@ResponseBody
	@RequestMapping(value = "/isCodeExist")
	public Boolean isCodeExist(String specCode){
		return cliSpecFacade.isCodeExist(specCode)  ;
	}
	
	@ResponseBody
	@RequestMapping(value = "/save")
	public InvokeResult save(CliSpecDTO cliSpecDTO){
		return  InvokeResult.success(cliSpecFacade.save(cliSpecDTO)) ;
	}
	
	@ResponseBody
	@RequestMapping(value = "/update")
	public InvokeResult update(CliSpecDTO cliSpecDTO){
		return  InvokeResult.success(cliSpecFacade.update(cliSpecDTO)) ;
	}
	
	@ResponseBody
	@RequestMapping(value = "/delete")
	public InvokeResult delete(String specCodes){
		return  InvokeResult.success(cliSpecFacade.delete(specCodes)) ;
	}
	
	@ResponseBody
	@RequestMapping(value = "/getDrgTree")
	public InvokeResult getDrgTree(String specCode,String version){
		return  InvokeResult.success(cliSpecFacade.getDrgTree(specCode ,version)) ;
	}
	
	@ResponseBody
	@RequestMapping(value = "/saveDrgsNode")
	public InvokeResult saveDrgsNode(String specCode,String version,String[] drgs){
		return  InvokeResult.success(cliSpecFacade.saveDrgsNode(specCode,version ,drgs)) ;
	}
	
	@ResponseBody
	@RequestMapping(value = "/findDrgsBySpec/{specCode}")
	public InvokeResult findAdrgBySpec(@PathVariable String specCode){
		return  InvokeResult.success(cliSpecFacade.findDrgsBySpec(specCode)) ;
	}
	
}
